<?php

namespace Modules\Admin\Http\Controllers;

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use Modules\Admin\Http\Requests\AuthLoginRequest;
use Modules\Admin\Http\Requests\AdminPostRequest;
use Modules\Admin\Services\AuthService;

class AuthController extends Controller
{
    protected $service = null;

    public function __construct()
    {
        $this->service = new AuthService();
    }

    /**
     * @return JsonResponse
     * 登录操作
     */
    public function login(AuthLoginRequest $request): JsonResponse
    {
        $param =  $request->only([
            'username',
            'password',
        ]);

        return $this->service->login($param);
    }

    /***
     * @return void
     * 退出
     */
    public function logout() : JsonResponse
    {
      return  $this->service->logout();
    }


    /***
     * @return mixed
     *我的
     */
    public function me()
    {
        return $this->service->me();
    }

}
